/**************************************************************************
 *
 * Copyright (C) 2007 University of California, Los Angeles.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 *************************************************************************/

/**
 * 
 */
package edu.ucla.cs.typecast.cache2;

import java.util.Date;

import edu.ucla.cs.typecast.net.EndPoint;

/**
 *
 * @date Aug 20, 2007
 */
public class CachedObject {
	private Object serviceObject; 
	private Class[] types; 
	private Class implementationClass; 
	private EndPoint contentSourceEndPoint; 
	private String guid;
	private Date timeout;
	
	/**
	 * @return the serviceObject
	 */
	public Object getServiceObject() {
		return serviceObject;
	}
	/**
	 * @param serviceObject the serviceObject to set
	 */
	public void setServiceObject(Object serviceObject) {
		this.serviceObject = serviceObject;
	}
	/**
	 * @return the types
	 */
	public Class[] getTypes() {
		return types;
	}
	/**
	 * @param types the types to set
	 */
	public void setTypes(Class[] types) {
		this.types = types;
	}
	/**
	 * @return the implementationClass
	 */
	public Class getImplementationClass() {
		return implementationClass;
	}
	/**
	 * @param implementationClass the implementationClass to set
	 */
	public void setImplementationClass(Class implementationClass) {
		this.implementationClass = implementationClass;
	}
	/**
	 * @return the contentSourceEndPoint
	 */
	public EndPoint getContentSourceEndPoint() {
		return contentSourceEndPoint;
	}
	/**
	 * @param contentSourceEndPoint the contentSourceEndPoint to set
	 */
	public void setContentSourceEndPoint(EndPoint contentSourceEndPoint) {
		this.contentSourceEndPoint = contentSourceEndPoint;
	}
	/**
	 * @return the guid
	 */
	public String getGuid() {
		return guid;
	}
	/**
	 * @param guid the guid to set
	 */
	public void setGuid(String guid) {
		this.guid = guid;
	}
	/**
	 * @return the timeout
	 */
	public Date getTimeout() {
		return timeout;
	}
	/**
	 * @param timeout the timeout to set
	 */
	public void setTimeout(Date timeout) {
		this.timeout = timeout;
	} 
	
	public int hashCode() { 
		return guid.hashCode(); 
	}
	
	public boolean equals(Object another) { 
		if(another instanceof CachedObject) { 
			CachedObject other = (CachedObject)another; 
			return guid.equals(other.getGuid()) && this.contentSourceEndPoint.equals(other.getContentSourceEndPoint()); 
		}
		return false; 
	}
}
